class RequestJS
{
    fetch(url, options)
    {
        let header = new Headers();

        //header.append("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36");
        header.append("User-Agent", "Custom User-Agent");
        header.append("Accept", "*/*");
        header.append('Accept-Language', "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
        header.append("Sec-Fetch-Dest", "empty");
        header.append("Sec-Fetch-Mode", "cors");
        header.append("Sec-Fetch-Site", "same-origin");
        header.append("Content-Type", "application/json");

        let params = {
            method: 'GET',
            mode: 'cors',
            redirect: 'follow'
        };

        if (options) {
            if (options.method) {
                params.method = options.method;
            }
    
            if (options.raw) {
                params.body = options.raw;
            }

            if (options.headers) {
                Object.keys(options.headers).forEach(function(key){
                    if (key=='token') {
                        header.append("Authorization", "Bearer " + options.headers[key]);
                    } else {
                        header.append(key, options.headers[key]);
                    }
                });
            }
        }

        params.headers = header;

        return fetch(url, params);
    }
}
var requestJs = new RequestJS();